#include <iostream>
#include <memory>
#include "udpserver.hpp"

// void Usage(std::string proc)
// {
//     std::cout << "usage:" << proc << ' ' << "ip" << ' ' << "port" << std::endl;
// }

void Usage(std::string proc)
{
    std::cout << "usage:" << proc << ' ' << "port" << std::endl;
}

int main(int argc, char *argv[])
{
    EnableScreen();
    // if (argc != 3)
    // {
    //     Usage(argv[0]);
    //     exit(usage_error);
    // }
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(usage_error);
    }
    // std::string ip = argv[1];
    // uint16_t prot = std::atoi(argv[2]);
    // std::unique_ptr<UdpServer> usr = std::make_unique<UdpServer>(ip, prot);
    uint16_t port = std::atoi(argv[1]);
    std::unique_ptr<UdpServer> usr = std::make_unique<UdpServer>(port);

    usr->init();
    usr->start();
    return 0;
}